/**
 * 
 */
package com.lys.po;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;

/**
 * 将firstName和lastName整合成fullName
 * 
 * @author lys
 * 
 */
public class FullName implements Serializable {

	/**
	 * serialVersionUID .
	 */
	private static final long serialVersionUID = 3901986464228389806L;

	private String firstName;

	private String lastName;

	public FullName(String firstName, String lastName) {
		super();
		this.firstName = firstName;
		this.lastName = lastName;
	}

	/**
	 * @return the firstName
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @param firstName
	 *            the firstName to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @return the lastName
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		int result;
		result = firstName == null ? 0 : firstName.hashCode();
		result = 29 * result + (lastName == null ? 0 : lastName.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this.equals(obj)) {
			return true;
		}
		if (!(obj instanceof FullName)) {
			return false;
		}
		FullName fullname = (FullName) obj;
		if (!firstName.equals(fullname.getFirstName())) {
			return false;
		}
		if (!lastName.equals(fullname.getLastName())) {
			return false;
		}
		return true;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return StringUtils.defaultString(lastName) + StringUtils.defaultString(firstName);
	}

}
